<?php
require_once 'pworks/mvc/result/PageConfigHelper.class.php';
require_once 'pworks/mvc/result/ModuleFactory.class.php';
/*
class PageLoader
{
    static $cacheHelper;

    public function load($page_id)
	{
		$page_obj_cache_key = 'OBJ_'. $page_id;
        $pageCfg = PageConfigHelper::getPageConfig($page_id);
        if (!self::$cacheHelper->fetch($page_obj_cache_key)) {
            $page = new CmsPage(); 
            $page->id = $pageCfg->id;
            $page->title = $pageCfg->title;
            $page->page_meta_kw = $pageCfg->keyword;
            $page->description = $pageCfg->desc;
            $page->skin = $pageCfg->skin;
            $page->template = $pageCfg->template;
            #page module
            foreach($pageCfg->modules as $module){
                $page->setRegion($module->name, ModuleFactory::getInstance($module->value, $module->params));
            }
            //$t = CmsManager::getEmbedContent();
            //$page->page_top = $t['top'];
            //$page->page_bottom = $t['bottom'];
           
            $page->init();
            self::$cacheHelper->store($page_obj_cache_key, serialize($page));
            return $page;
        } else {
            foreach ($pageCfg->modules as $obj) {
                if ($obj->value) {
                    # load Module Class to wake up obj
                    ModuleFactory::loadModuleFile($obj->value);
                }
            }
            $page = self::$cacheHelper->fetch($page_obj_cache_key);
            return unserialize($page);
        }
    }
}
*/
